package com.vlad.domen;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;

import com.vlad.domen.consumers.Consumer;
import com.vlad.domen.util.Logger;

public class Main {
	public static void main(String[] args) throws InterruptedException {
		Restaurant restaurant = new Restaurant(10, 3);
		ExecutorService executorService = Executors.newFixedThreadPool(15);
		TimeUnit.SECONDS.sleep(2);
		for (int i = 0; i < 15; i++) {
			executorService.submit(new Consumer(restaurant, i));
		}
		TimeUnit.SECONDS.sleep(7); // Run for a while...
		restaurant.stop();
		executorService.shutdownNow();
		System.out.println(Logger.getLog());
	}
}
